feat: PositiveTemperature (closed for large commit size)#969
feat: PositiveTemperature (closed for large commit size)#969ichxorya wants to merge 19 commits intoleanprover-community:masterfrom
Conversation
…he Thermodynamics module (with some extend to StatisticalMechanics since it depends on Thermodynamics)
…ine comments TODO: from `tendsto_const_inv_mul_bound_pos` downwards
* TODO: From `tendsto_ofβ_atTop` downwards
* Note: In `Calculus relating T and β`, the proofs are not really cleaned and humanized since it's kinda out of my league.
…ut the type definition)
* Introduce `TemperatureScale` structure with detailed documentation. * Implement conversion functions between kelvin and affine scales. * Add lemmas to verify the identity of conversions. * Define specific temperature scales: Celsius, Fahrenheit, and Rankine. * Improve documentation for clarity and completeness. * Refactor existing functions for better readability and maintainability.
* Added import for `TemperatureScales` in `PhysLean.lean`. * Reformatted code for better readability in several lemmas across temperature-related files. * Removed unnecessary blank lines to improve code clarity.
…itions (breaking change warning, currently only Basic.lean is compilable)
…lean (breaking change warning, currently only Basic.lean is compilable)
…ture and the Beta function; add Calculus.lean for PositiveTemperature (breaking change warning)
|
@jstoobysmith I would like to ask for direction from here. As of now, the code in Temperature is compilable. However, when it comes to the dependency at CanonicalEnsemble, I don't know what would actually work. Can you break the necessary rework for me (i.e. in terms of types, theorems, lemmas) so that I can follow it to finish this PR. @hungle0503 would you also mind looking at this too? Note that a vibe-coded solution is available at c853862 but I think it is wrong since it defines this /-- Construct a `PositiveTemperature` from a real-valued inverse temperature,
defaulting to a junk value for non-positive inputs. Used for `derivWithin` helpers
that need a total function `ℝ → PositiveTemperature`. -/
noncomputable def ofβ_real (b : ℝ) : PositiveTemperature :=
if h : 0 < b then ofβ ⟨b, h⟩ else ofβ ⟨1, one_pos⟩Thus, it shouldn't be right due to that junk value when we define the total function (could a partial function work?) |
|
Hi @ichxorya, the problem with this PR is that it is still too big, which makes it very hard to review properly. In the end it will be quicker for everyone if we split this up into multiple PRs (aim for like 200-500 lines of changes each). I would start with just submitting the changes in: |
Thank you, I would follow that! |
Ref: #958 #861 #860
In this PR I will construct relevant API for PositiveTemperature as discussed in #958